#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pi;
#define debug(a) cout<<#a<<":"<<a<<endl;
#define fr freopen("in.txt","r",stdin);
#define for0(i,a,b) for (int i=a;(i<b);i++)
#define for1(i,a,b) for (int i=a;(i<=b);i++)
#define dec0(i,a,b) for (int i=a;(i>b);i--)
#define dec1(i,a,b) for (int i=a;(i>=b);i--)
#define Fill(x,a) memset(x,a,sizeof(x))
const int INF=0x3f3f3f3f;
const int N=1e6+7;
const int mod=1e9+7;
int maxn,minn;
int T,n,m,q;
int dp[N];
char s[N];

int main(){
	cin>>T;
	for1(t,1,T){
		Fill(dp,INF);
		cin>>n>>m;
		scanf("%s",s+1);
		dp[1]=0;
		for1(i,2,n){
			if(s[i]=='X'){
				dp[i]=0;
				continue;
			}
			for1(j,max(1,i-m-1),i-1){
				if(s[j]!='X'){
					dp[i]=min(dp[i],dp[j]+1);
				}
			}
		}
		printf("Day #%d\n",t);
		printf("%d %d\n",n,m);
		printf("%s\n",s+1);
		if(dp[n]==INF){
			dp[n]=0;
		}
		printf("%d\n",dp[n]);
		if(t!=T){
			printf("\n");
		}
	}


	return 0;
}


